<?php $_hidden_elements = array(); ?>

<form class="login_f" <?php foreach ($form->attrs() as $attr => $value): $value = h($value); echo "{$attr}=\"{$value}\" "; endforeach; ?>>

    <?php if ($form->_subject): ?>
    
    <?php endif; ?>
<table id="login_table">
<?php
foreach ($form->elements() as $element):
    if ($element->_ui == 'hidden')
    {
        $_hidden_elements[] = $element;
        continue;
    }
    $id = $element->id;
?>
<tr><td>
  <p id="<?php echo $element->id; ?>_wrap" <?php if ($element->_hidden): ?>class="hidden"<?php endif; ?>>
    <?php if ($element->_label): ?><label for="<?php echo $id; ?>"><?php echo h($element->_label); ?>&nbsp;<?php if ($element->_req): ?><span class="req">*</span><?php endif; ?></label><?php endif; ?>

    <?php if ($element->_tips): ?><span class="tips"><?php echo nl2br(str_replace(array('[b]', '[/b]'), array('<strong>', '</strong>'), h($element->_tips))); ?></span><?php endif; ?>

    

    <?php //echo Q::control($element->_ui, $id, $element->attrs()); ?>
    <?php //换成下面这个可以保证输入错误后返回为过滤转换前的数值 ?>
    <?php 
        $attrs = $element->attrs();
        $attrs['value'] = $element->unfilteredValue(); 
        echo Q::control($element->_ui, $id, $attrs);
    ?>

  </p></td>
</tr>
<?php
endforeach;
?>
    <tr><td colspan="2" id="but">
		<input type="submit" name="btn_submit" class="login_btn" value="" />
		<img src="images/reset.png" id="resetBut" class="login_btn_f" alt="重置" onclick="resetForm()" />
	</td></tr>
	
	<tr><td colspan="2" class="error_part"><?php
foreach ($form->elements() as $element):
    if ($element->_ui == 'hidden')
    {
        $_hidden_elements[] = $element;
        continue;
    }
    $id = $element->id;
?>
<?php if (!$element->isValid()): ?>
    <span class="error"><?php echo nl2br(h(implode("，", $element->errorMsg()))); ?></span>
    <?php endif; ?>
	<?php
endforeach;
?>
	</td></tr>
	
	</table>
</form>
